
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    2000-2016年的闰年次数是: <br>
    <%!  boolean runnian(int i){
    if((i%4==0&&i%100!=0)||i%400==0){
  			  return true;
    }
    return false;
    }
     %>
     <%
     int sum = 0;
     for(int i=2000;i<=2016;i++){
     if(runnian(i)){
     sum++;
     }
     }
      %>
      <%=sum %>
      <p>
   		   现在的日期是:<br/>
   		   <%
   		   SimpleDateFormat sim = new SimpleDateFormat("yy-MM-dd hh:mm:ss");
   			String date=  sim.format(new Date());
   			out.print(date);
   		    %>
      </p>
      <p>
      1-100之间的素数和:<br>
      <%!
      boolean sushu(int i){
      if(i==1){
      return false;
      }
      for(int k=2;k<Math.sqrt(k);k++){
      if(i%k==0){
      return true ;
      }
      }
      return false;
      }
       %>
       <%
       int sum2=0;
       for(int i=1;i<=100;i++ ){
       if(!sushu(i)){
       sum2+=i;
       }
       
       }
       out.print(sum2);
        %>
      <p/>
     
     
     
  </body>
</html>
